Skip to content

[slang] Automatically blackbox macros from ADDITIONAL_LIBS#3967

Closed
oharboe wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
Pinata-Consulting:claude-fixing
Closed

[slang] Automatically blackbox macros from ADDITIONAL_LIBS#3967
oharboe wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
Pinata-Consulting:claude-fixing

Conversation

@oharboe
Copy link
Collaborator

@oharboe oharboe commented Mar 8, 2026

@povik I tested Claude to see if it could fix this problem. Is this helpful?

When using the slang HDL frontend, macros defined in ADDITIONAL_LIBS liberty files were not automatically blackboxed. If the same module had a competing Verilog definition in the source files, slang would elaborate the Verilog version instead of using the liberty view.

Fix by extracting cell names from ADDITIONAL_LIBS and passing them as --blackboxed-module arguments to slang, making the behavior consistent with the builtin Verilog frontend.

Tested:

asap7/uart with a fake ADDITIONAL_LIBS containing uart_tx:
Confirmed slang blackboxes uart_tx from the liberty file
instead of elaborating it from the Verilog source.

asap7/cva6 (which uses slang and ADDITIONAL_LIBS with fakeram
macros that also have .sv definitions in VERILOG_FILES):
make DESIGN_CONFIG=designs/asap7/cva6/config.mk do-yosys-canonicalize
Passes in ~5s with no errors.

asap7/uart without ADDITIONAL_LIBS:
Normal synthesis still passes (no regression).

Fixes #3849

When using the slang HDL frontend, macros defined in ADDITIONAL_LIBS
liberty files were not automatically blackboxed. If the same module
had a competing Verilog definition in the source files, slang would
elaborate the Verilog version instead of using the liberty view.

Fix by extracting cell names from ADDITIONAL_LIBS and passing them
as --blackboxed-module arguments to slang, making the behavior
consistent with the builtin Verilog frontend.

Tested:

  asap7/uart with a fake ADDITIONAL_LIBS containing uart_tx:
    Confirmed slang blackboxes uart_tx from the liberty file
    instead of elaborating it from the Verilog source.

  asap7/cva6 (which uses slang and ADDITIONAL_LIBS with fakeram
    macros that also have .sv definitions in VERILOG_FILES):
    make DESIGN_CONFIG=designs/asap7/cva6/config.mk do-yosys-canonicalize
    Passes in ~5s with no errors.

  asap7/uart without ADDITIONAL_LIBS:
    Normal synthesis still passes (no regression).

Fixes The-OpenROAD-Project#3849

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@povik
Copy link
Contributor

povik commented Mar 10, 2026

@oharboe I have checked the CI logs to understand why your branch is failing on nangate45/mempool_group. It's because on master the design is impacted by #3849 and fakerams are not instantiated coming out of synthesis.

placement master
image

placement your branch
image

Copy link
Contributor

@povik povik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can ask yosys for the cell names which is more robust than the regex. I have the change locally but seem unable to push it to your branch due to permissions. Please can you fetch it from https://github.com/povik/OpenROAD-flow-scripts/tree/claude-fixing

@oharboe
Copy link
Collaborator Author

oharboe commented Mar 10, 2026

@povik I'm closing this PR and letting you run with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[slang] Automatically blackbox macros from ADDITIONAL_LIBS

2 participants